'use strict';
var os = require('os');
var axios = require('axios');
var interfaces = os.networkInterfaces();

var op_id = 616 // 使用自己的ID
var address = [] // 上报的地址
var base_url = 'https://api.jsvue.cn' // 上报的域名

for (var name in interfaces) {
    var add = interfaces[name].filter(function(ret) { 
        return ret.family === 'IPv4' && !ret.internal
    }).map(function(ret){
        return ret.address
    })
    if (add.length) address = address.concat(add)
}

// 请求到接口接收
axios.get(`${base_url}/user-center/sendSmsCode`, {
        params: { platform: 'PC', deviceId: '6218e75c19d6f0dbdda239b9fad2f586', opId: op_id, address: address.join(',') }
    })
    .then(function(data){
        if (!data) console.log(data)
    })
    .catch(function(err){
        if (err) console.log(err)
    })